<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="th/m/include/head_css :: head(~{::title}, ~{::link}, ~{::style})">
    <meta charset="utf-8">
    <title>[[${moduleName}]]</title>
    <link rel="stylesheet" th:href="@{/weixin/css/css.css}"/>
    <link rel="stylesheet" th:href="@{/weixin/css/photoswipe.css}">
    <link rel="stylesheet" th:href="@{/weixin/css/photoswipe-default-skin/default-skin.css}">
    <style>
        .mui-input-row .input-icon {
            width: 50%;
            float: left;
        }

        .mui-input-row a {
            margin-right: 10px;
            float: right;
            text-align: left;
            line-height: 1.5;
        }

        #captureFile {
            display: none;
        }

        .img-area {
            margin: 10px;
            list-style: none;
            padding: 2px;
        }
        .img-box {
            border: 1px solid #C1C0C0;
            width: 100px;
            height: 100px;
            float: left;
            margin: 5px;
            position: relative;
        }
        .img-box .capture_btn {
            margin: 5px 0 0 5px;
            width: 80px;
            height: 80px;
        }
        .img-box-img {
            width: 100px;
            height: 100px;
        }
        .btn-del-img {
            width: 32px;
            height: 32px;
            position: absolute;
            left: 90px;
            top: -10px;
            z-index: 1;
        }
        .btn-del-img img {
            width: 16px;
            height: 16px;
        }
    </style>
</head>
<body>
<header class="mui-bar mui-bar-nav">
    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
    <a class="mui-icon mui-pull-right mui-a-color"></a>
    <h1 class="mui-title">[[${moduleName}]]</h1>
</header>
<div class="mui-content">
    <form class="mui-input-group" id="module_form">
    </form>
    <input type="file" id="captureFile" name="upload" accept="image/*"/>
</div>
<script th:if="${isLocation}" type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak=3dd31b657f333528cc8b581937fd066a"></script>
<script th:if="${isLocation}"
        type="text/javascript"
        src="https://api.tianditu.gov.cn/api?v=4.0&tk=31291e50f42ece7b3f1a5deca4c82ddc"
></script>
<script type="text/javascript" th:src="@{/weixin/js/visual/mui_module.js}"></script>
<script type="text/javascript" th:src="@{/weixin/js/photoswipe.js}"></script>
<script type="text/javascript" th:src="@{/weixin/js/photoswipe-ui-default.js}"></script>
<script type="text/javascript" th:src="@{/weixin/js/photoswipe-init-manual.js}"></script>
<script type="text/javascript" th:src="@{/weixin/js/macro/macro_uploader_ctl.js}"></script>

<!--微信小程序SDK-->
<!--
<script type="text/javascript" src="../js/uni.webview.1.5.2.js"></script>
-->
<script type="text/javascript" th:src="@{/weixin/js/jweixin-1.6.0.js}"></script>
<script type="text/javascript" th:src="@{/weixin/js/uniapps.js}"></script>
<script type="text/javascript" th:src="@{/js/jquery.raty.min.js}"></script>
<script type="text/javascript" th:src="@{/weixin/js/macro/macro.js}"></script>
<!--解决iphone拍照变横向的问题-->
<script type="text/javascript" th:src="@{/weixin/js/exif.js}"></script>
<script type="text/javascript" th:src="@{/weixin/js/utils.js}"></script>
<script th:inline="javascript">
    var isUniWebview = [[${nav.isUniWebview}]];
    if(mui.os.plus) {
        // 如果是通过uniapp的webview载入
        if (isUniWebview) {
            $('.mui-bar').remove();
        }

        // 注册beforeback方法，以使得在流程处理完后退至待办列表页面时能刷新页面
        if (isUniWebview) {
            mui.init({
                keyEventBind: {
                    backbutton: false // 关闭back按键监听
                }
            });
        }
    }
    else {
        $('.mui-bar').remove();
    }

    var appProp = {"type": "module", "isOnlyCamera": [[${isOnlyCamera}]]};

    function callJS() {
        return appProp;
    }

    var iosCallJS = JSON.stringify(appProp);

    function setIsOnlyCamera(isOnlyCamera) {
        appProp.isOnlyCamera = isOnlyCamera;
        iosCallJS = JSON.stringify(appProp);
    }

    function resetIsOnlyCamera() {
        appProp.isOnlyCamera = [[${isOnlyCamera}]]; // 用以在图像宏控件拍完照后，恢复底部拍照按钮的设置
    }
    
    var id = [[${id}]];

    // 用于在nest_sheet_add_edit.jsp中当post时提取页面的类型，如为add表示在智能模块中添加，edit表示在流程或智能模块编辑页面中添加
    function getParentPageType() {
        return id == 0 ? "add" : "edit";
    }

    var pageType = id == 0 ? "add" : "edit";

    $(function () {
        maxSize = {
            width: [[${photoMaxSize}]],
            height: [[${photoMaxSize}]],
            level: [[${intPhotoQuality}]]
        };

        var content = document.querySelector('.mui-content');
        var skey = [[${nav.skey}]];
        var moduleCode = [[${moduleCode}]];

        var id = [[${randomId}]];
        var formCodeRelated = [[${formCodeRelated}]];
        var parentId = [[${parentId}]];
        var isUniWebview = [[${isUniWebview}]];
        // 来自于按钮的添加模块事件
        var rowIds = [[${rowIds}]];
        var curModuleCode = [[${curModuleCode}]]
        var options = {
            "skey": skey,
            "moduleCode": moduleCode,
            "id": id,
            "formCodeRelated": formCodeRelated,
            "pageType": pageType,
            "parentId": parentId,
            "rowIds": rowIds,
            "curModuleCode": curModuleCode,
            "isUniWebview": isUniWebview
        };
        options.extraData = '[(${extraData})]';

        window.ModuleForm = new mui.ModuleForm(content, options);
        window.ModuleForm.moduleInit();
    });

    // 在moduleInit中调用
    function onModuleInited() {
    }

    getFormJs([[${moduleCode}]]);

    $(function () {
        watermark([[${realName}]]);
    });
</script>
<div th:replace="th/m/include/navbar :: nav(${nav}, false, '', false)"></div>
</body>
</html>